package it.antonio.ilpizze.db.index.hash.memory;

import it.antonio.ilpizze.db.index.hash.Element;
import it.antonio.ilpizze.db.index.hash.ElementList;
import it.antonio.ilpizze.db.index.hash.HashTable;

public abstract class MemoryHashTable<K,V> extends HashTable<K, V> {
	
	private static final int M = 16;
	
	private int degree;
	private MemoryEntryList<K,V> list;
	
	public MemoryHashTable(int degree) {
		this.degree = degree;
		this.list = new MemoryEntryList<K,V>(degree);
		
	}

	public MemoryHashTable() {
		this(M);
	}
	
	
	@Override
	protected int degree() {
		return degree;
	}

	@Override
	protected ElementList<K,V> elementList() {
		return list;
	}

	@Override
	protected Element<K,V> createElement(int hash, K key, V value) {
		return new MemoryEntry<K,V>(hash, key,value);
	}

}
